﻿@{
    Layout = "~/Views/Shared/Main.cshtml";
}
@section head{
    <script type="text/javascript" src="/Scripts/plug.js"></script>
}
<div class="box">
    <div class="title">
        <h3>
            用户登录</h3>
    </div>
    <div class="box-content">
        <form id="loginform" method="post" action="/account/login" class="form-horizontal">
        <input type="hidden" name="token" />
        <input type="hidden" name="ReturnUrl" value="@ViewBag.Return" />
        <div class="control-group">
            <label class="control-label">
                账 号</label>
            <div class="controls">
                <input type="text" id="txtuserName" name="userName" class="span4 {required:true,email:true}" 
                    value="@ViewBag.UserName" placeholder="请输入登录帐号" />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">
                密 码</label>
            <div class="controls">
                <input type="password" id="txtpwd" name="password" class="span4 {required:true}" placeholder="请输入帐号密码" />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">
                验 证</label>
            <div class="controls">
                <div class="span3" style="margin-left:0px;">
                    <input type="text" id="txtvaildcode" name="validcode"
                     class="pull-left {required:true,minlength:4,maxlength:4}" 
                     placeholder="请输入右侧验证码" />
                </div>
                <div id="codeimg" style="margin-left: 10px; "> 
                   
                </div>
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
                <label>
                    <p class="text-error">
                        <a href="/account/register">立即注册</a>
                        | <a href="/account/forgotpassword">忘记密码？</a></p>
                        
                </label>
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
            @if (!String.IsNullOrEmpty(ViewBag.Error))
            {
                <label>
                    <p class="text-error">
                        @ViewBag.Error</p>
                </label>
            }
                <input type="submit" class="btn" style="width:20%" value="登 录" />
            </div>
        </div>
        </form>
    </div>
</div>
@section tail {
    <script type="text/javascript" src="/Scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/Scripts/jquery.metadata.js"></script>
    <script type="text/javascript">
        var validation = new plug.BindValidCode();
        $(function () {
            validation.BindValidator();
            $('#loginform').validate({
                errorClass: "help-inline",
                errorElement: "span",
                highlight: function (element, errorClass, validClass) {
                    $(element).parents('.control-group').addClass('error');
                },
                unhighlight: function (element, errorClass, validClass) {
                    $(element).parents('.control-group').removeClass('error');
                }
            });
        });
        function Refalsh(sender) {
            validation.Refalsh(sender);
        }
    </script>
}